home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 February / SGI IRIX 6.5 Complementary Applications 2004 February.iso / dist / cde.idb / usr / dt / share / examples / dtcalendar / attributes.c.z / attributes.c
Encoding:
C/C++ Source or Header  |  2003-11-18  |  2.5 KB  |  90 lines

  1. /*
  2.  * attributes.c
  3.  *
  4.  * Copyright 2000, Silicon Graphics, Inc.
  5.  * ALL RIGHTS RESERVED
  6.  * 
  7.  * UNPUBLISHED -- Rights reserved under the copyright laws of the United
  8.  * States.   Use of a copyright notice is precautionary only and does not
  9.  * imply publication or disclosure.
  10.  *
  11.  * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
  12.  * Use, duplication or disclosure by the Government is subject to restrictions
  13.  * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
  14.  * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
  15.  * in similar or successor clauses in the FAR, or the DOD or NASA FAR
  16.  * Supplement.  Contractor/manufacturer is Silicon Graphics, Inc.,
  17.  * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
  18.  *
  19.  * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
  20.  * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
  21.  * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
  22.  * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
  23.  * GRAPHICS, INC.
  24.  */
  25. /* $XConsortium: attributes.c /main/cde1_maint/1 1995/07/17 16:41:12 drk $ */
  26. /*
  27.  *  (c) Copyright 1993, 1994 Hewlett-Packard Company    
  28.  *  (c) Copyright 1993, 1994 International Business Machines Corp.
  29.  *  (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  30.  *  (c) Copyright 1993, 1994 Novell, Inc.
  31.  */
  32.  
  33. /*
  34.  * attributes.c - retrieve calendar attributes
  35.  */
  36.  
  37. #include <stdio.h>
  38. #include <stdlib.h>
  39. #include <time.h>
  40. #include <string.h>
  41. #include <sys/param.h>
  42. #include <sys/types.h>
  43.  
  44. #include <csa/csa.h>
  45.  
  46. void main(int argc, char **argv)
  47. {
  48.     CSA_session_handle cal;
  49.     CSA_calendar_user user;
  50.     CSA_uint32 num_names;
  51.     CSA_attribute_reference *names;
  52.     CSA_return_code    stat;
  53.     int i;
  54.  
  55.     if (argc < 2) {
  56.         printf("usage: %s user@host\n", argv[0]);
  57.         return;
  58.     }
  59.  
  60. #if defined ( linux )
  61.     memset((void *)&user, 0, sizeof(CSA_calendar_user));
  62. #else /* linux */
  63.     memset((void *)&user, NULL, sizeof(CSA_calendar_user));
  64. #endif /* linux */
  65.     user.calendar_address = argv[1];
  66.  
  67.     if ((stat = csa_logon(NULL, &user, NULL, NULL, NULL, &cal, NULL))
  68.         != CSA_SUCCESS)
  69.     {
  70.         printf("Logon to %s failed, stat = %d\n", argv[1],
  71.             stat);
  72.         return;
  73.     }
  74.  
  75.     if ((stat = csa_list_calendar_attributes(cal, &num_names, &names,
  76.         NULL)) == CSA_SUCCESS) {
  77.  
  78.         printf("List calendar attributes:\n");
  79.         for (i = 0; i < num_names; i++)
  80.             printf("%s\n", names[i]);
  81.  
  82.         csa_free(names);
  83.     } else
  84.         printf("csa_list_calendar_attributes failed, stat = %d\n",
  85.             stat);
  86.  
  87.     (void)csa_logoff(cal, NULL);
  88. }
  89.  
  90.